﻿
#include "ros2_support_base.h"

namespace spadas
{
    struct Ros2FileIOWriteMessageObjectData
    {
        String fileName;
        Double time;
        String topic;
        String dataType;
        Binary binaryData;
        Bool writeToGeneration;
    };

    enum class Ros2FileIOWriteMessageObjectField
    {
        FileName = 0,
        Time = 1,
        Topic = 2,
        DataType = 3,
        BinaryData = 4,
        WriteToGeneration = 5,
    };

    class Ros2FileIOWriteMessageObjectVars : public FlexVars<Ros2FileIOWriteMessageObjectData>
    {
    public:
        SPADAS_VARS(Ros2FileIOWriteMessageObject, FlexVars<Ros2FileIOWriteMessageObjectData>);
        Ros2FileIOWriteMessageObjectVars() : FlexVars<Ros2FileIOWriteMessageObjectData>(
            Array<Int>::create(6
            ,Ros2FileIOWriteMessageObjectField::FileName
            ,Ros2FileIOWriteMessageObjectField::Time
            ,Ros2FileIOWriteMessageObjectField::Topic
            ,Ros2FileIOWriteMessageObjectField::DataType
            ,Ros2FileIOWriteMessageObjectField::BinaryData
            ,Ros2FileIOWriteMessageObjectField::WriteToGeneration
            )) {}
    };
}

namespace spadas
{
    struct Ros2FileIORegisterReadStreamObjectData
    {
        Bool readFromGeneration;
        String fileName;
        String topic;
        Stream<Ros2FileIOReadMessage> readStream;
    };

    enum class Ros2FileIORegisterReadStreamObjectField
    {
        ReadFromGeneration = 0,
        FileName = 1,
        Topic = 2,
        ReadStream = 3,
    };

    class Ros2FileIORegisterReadStreamObjectVars : public FlexVars<Ros2FileIORegisterReadStreamObjectData>
    {
    public:
        SPADAS_VARS(Ros2FileIORegisterReadStreamObject, FlexVars<Ros2FileIORegisterReadStreamObjectData>);
        Ros2FileIORegisterReadStreamObjectVars() : FlexVars<Ros2FileIORegisterReadStreamObjectData>(
            Array<Int>::create(4
            ,Ros2FileIORegisterReadStreamObjectField::ReadFromGeneration
            ,Ros2FileIORegisterReadStreamObjectField::FileName
            ,Ros2FileIORegisterReadStreamObjectField::Topic
            ,Ros2FileIORegisterReadStreamObjectField::ReadStream
            )) {}
    };
}

using namespace spadas;

Ros2FileIOWriteMessageObject::Ros2FileIOWriteMessageObject() : Object<Ros2FileIOWriteMessageObjectVars>(new Ros2FileIOWriteMessageObjectVars, TRUE)
{}

String Ros2FileIOWriteMessageObject::getFileName()
{
    if (vars->has((Int)Ros2FileIOWriteMessageObjectField::FileName)) return vars->cast().fileName;
    else return "";
}
void Ros2FileIOWriteMessageObject::setFileName(String val)
{
    if (vars->has((Int)Ros2FileIOWriteMessageObjectField::FileName)) vars->cast().fileName = val;
}
Double Ros2FileIOWriteMessageObject::getTime()
{
    if (vars->has((Int)Ros2FileIOWriteMessageObjectField::Time)) return vars->cast().time;
    else return 0;
}
void Ros2FileIOWriteMessageObject::setTime(Double val)
{
    if (vars->has((Int)Ros2FileIOWriteMessageObjectField::Time)) vars->cast().time = val;
}
String Ros2FileIOWriteMessageObject::getTopic()
{
    if (vars->has((Int)Ros2FileIOWriteMessageObjectField::Topic)) return vars->cast().topic;
    else return "";
}
void Ros2FileIOWriteMessageObject::setTopic(String val)
{
    if (vars->has((Int)Ros2FileIOWriteMessageObjectField::Topic)) vars->cast().topic = val;
}
String Ros2FileIOWriteMessageObject::getDataType()
{
    if (vars->has((Int)Ros2FileIOWriteMessageObjectField::DataType)) return vars->cast().dataType;
    else return "";
}
void Ros2FileIOWriteMessageObject::setDataType(String val)
{
    if (vars->has((Int)Ros2FileIOWriteMessageObjectField::DataType)) vars->cast().dataType = val;
}
Binary Ros2FileIOWriteMessageObject::getBinaryData()
{
    if (vars->has((Int)Ros2FileIOWriteMessageObjectField::BinaryData)) return vars->cast().binaryData;
    else return Binary();
}
void Ros2FileIOWriteMessageObject::setBinaryData(Binary val)
{
    if (vars->has((Int)Ros2FileIOWriteMessageObjectField::BinaryData)) vars->cast().binaryData = val;
}
Bool Ros2FileIOWriteMessageObject::getWriteToGeneration()
{
    if (vars->has((Int)Ros2FileIOWriteMessageObjectField::WriteToGeneration)) return vars->cast().writeToGeneration;
    else return FALSE;
}
void Ros2FileIOWriteMessageObject::setWriteToGeneration(Bool val)
{
    if (vars->has((Int)Ros2FileIOWriteMessageObjectField::WriteToGeneration)) vars->cast().writeToGeneration = val;
}

Ros2FileIORegisterReadStreamObject::Ros2FileIORegisterReadStreamObject() : Object<Ros2FileIORegisterReadStreamObjectVars>(new Ros2FileIORegisterReadStreamObjectVars, TRUE)
{}

Bool Ros2FileIORegisterReadStreamObject::getReadFromGeneration()
{
    if (vars->has((Int)Ros2FileIORegisterReadStreamObjectField::ReadFromGeneration)) return vars->cast().readFromGeneration;
    else return FALSE;
}
void Ros2FileIORegisterReadStreamObject::setReadFromGeneration(Bool val)
{
    if (vars->has((Int)Ros2FileIORegisterReadStreamObjectField::ReadFromGeneration)) vars->cast().readFromGeneration = val;
}
String Ros2FileIORegisterReadStreamObject::getFileName()
{
    if (vars->has((Int)Ros2FileIORegisterReadStreamObjectField::FileName)) return vars->cast().fileName;
    else return FALSE;
}
void Ros2FileIORegisterReadStreamObject::setFileName(String val)
{
    if (vars->has((Int)Ros2FileIORegisterReadStreamObjectField::FileName)) vars->cast().fileName = val;
}
String Ros2FileIORegisterReadStreamObject::getTopic()
{
    if (vars->has((Int)Ros2FileIORegisterReadStreamObjectField::Topic)) return vars->cast().topic;
    else return FALSE;
}
void Ros2FileIORegisterReadStreamObject::setTopic(String val)
{
    if (vars->has((Int)Ros2FileIORegisterReadStreamObjectField::Topic)) vars->cast().topic = val;
}
Stream<Ros2FileIOReadMessage> Ros2FileIORegisterReadStreamObject::getReadStream()
{
    if (vars->has((Int)Ros2FileIORegisterReadStreamObjectField::ReadStream)) return vars->cast().readStream;
    else return FALSE;
}
void Ros2FileIORegisterReadStreamObject::setReadStream(Stream<Ros2FileIOReadMessage> val)
{
    if (vars->has((Int)Ros2FileIORegisterReadStreamObjectField::ReadStream)) vars->cast().readStream = val;
}